package com.lvmama.client.rhino;

import com.lvmama.common.result.Result;
import com.lvmama.pojo.base.Page;
import com.lvmama.pojo.base.ResultBase;
import com.lvmama.pojo.dto.rhino.system.UserDTO;
import com.lvmama.pojo.dto.rhino.system.UserQueryDTO;
import com.lvmama.pojo.entity.rhino.system.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("rhino-web-service")
@RequestMapping("${server.servlet.context-path}")
public interface UserClient {

    @RequestMapping(method = RequestMethod.GET, value = "/user/findByUsername", consumes = "application/json")
    ResultBase<User> findByUsername(@RequestParam(value = "username") String username);

    @RequestMapping(method = RequestMethod.GET, value = "/user/findAll", consumes = "application/json")
    List<User> findAll();

    @RequestMapping(method = RequestMethod.GET,value = "/user/getUserPage",consumes = "application/json")
    Result<Page<User>> getUserPage(@RequestBody UserQueryDTO userQueryDTO);

    @RequestMapping(method = RequestMethod.POST,value = "/user/deleteUserById",consumes = "application/json")
    Result<Boolean> deleteUserById(@RequestParam("id") String id);

    @RequestMapping(method = RequestMethod.POST,value = "/user/getUserList",consumes = "application/json")
    Result<List<User>> getUserList(@RequestBody UserQueryDTO queryDTO);

    @RequestMapping(method = RequestMethod.POST,value = "/user/saveUserByUserDTO",consumes = "application/json")
    Result saveUserByUserDTO(@RequestBody UserDTO userDTO);

    @RequestMapping(method = RequestMethod.POST,value = "/user/updateUserByUserDTO",consumes = "application/json")
    Result updateUserByUserDTO(@RequestBody UserDTO userDTO);

    @RequestMapping(method = RequestMethod.POST,value = "/user/getUserRoleById",consumes = "application/json")
    Result<User> getUserRoleById(@RequestParam("id") String id);
    @RequestMapping(method = RequestMethod.POST,value = "/user/enableUserById",consumes = "application/json")
    Result<Integer> enableUserById(@RequestParam("id") String id);

    @RequestMapping(method = RequestMethod.POST,value = "/user/updateUserLoginDateByUserId",consumes = "application/json")
    Result updateUserLoginDateByUserId(@RequestParam("id") String id);
}
